import myaxios from "../MyAxios";
//引入路径前缀
import BASEURL from "../BaseUrl";
const { BaseURL } = BASEURL;

const userInfoApi = {
  /**
   * 查询所有用户信息
   * @param {Object} params {size:5,nowPage:1}
   */
  queryAllUser(params) {
    let url = BaseURL + `/v1/userinfo`;
    return myaxios.post(url, params);
  },

  /**
   * 模糊查询用户
   * @param {Object} params {username:xxx} or {usertel:xxx}
   */
  queryUserByValue(params) {
    let url = BaseURL + `/v1/userinfo-single`;
    return myaxios.post(url, params);
  },

  /**
   * 新增用户
   * @param {Object} params
   * @returns Promise
   */
  add(params) {
    let url = BaseURL + `/v1/adduser-bysys`;
    return myaxios.post(url, params);
  },

  /**
   * 修改用户信息
   * @param {Object} params
   * @returns Promise
   */
  update(params) {
    let url = BaseURL + `/v1/update`;
    return myaxios.post(url, params);
  },

  /**
   * 删除用户
   * @param {Object} params {username:xxx}
   * @returns Promise
   */
  deleteUser(params) {
    let url = BaseURL + `/v1/delete-user`;
    return myaxios.post(url, params);
  },

  /**
   * 查询master
   * @returns Promise
   */
  queryMaster() {
    let url = BaseURL + `/v1/master`;
    return myaxios.get(url);
  },
};

export default userInfoApi;
